﻿using System;
using System.Web;

namespace SystemX.Web.Infrastructure
{
    public struct SWFParamData
    {

        #region member variables
        private string _CurrentSessionID;
        /// <summary>
        /// Current Session id
        /// </summary>
        public string CurrentSessionID
        {
            get
            {
                return _CurrentSessionID;
            }
        }
        private string _Flag;
        /// <summary>
        /// Flag
        /// </summary>
        public string Flag
        {
            get { return _Flag; }
        }
        public string _FlagValue;
        /// <summary>
        /// Flag's value
        /// </summary>
        public string FlagValue
        {
            get { return _FlagValue; }
        }
        private string _UserID;
        /// <summary>
        /// Current UserID
        /// </summary>
        public string UserID
        {
            get { return _UserID; }
        }
        private int _ImgSize;
        /// <summary>
        /// Img size.If the user upload a img
        /// </summary>
        public int ImgSize
        {
            get { return _ImgSize; }
        }
        #endregion

        public SWFParamData(HttpContext context)
        {
            var request = context.Request;
            _CurrentSessionID = request["ASPSESSID"];
            _Flag = request["flag"];
            _FlagValue = request["flagValue"];
            _ImgSize = string.IsNullOrEmpty(request["imgsize"]) ? 80 : Convert.ToInt32(request["imgsize"]);
            _UserID = string.IsNullOrEmpty(request["userid"]) ? Utils.CurrentUserID ?? "public" : request["userid"];
        }
    }
}
